Skip to content

Position the head of dates for ticklabels in respect to axis side and ticklabelposition on x-axis - #5326

Merged
archmoj merged 4 commits into
masterfrom
date-head-label-on-sides
Dec 8, 2020
Merged

Position the head of dates for ticklabels in respect to axis side and ticklabelposition on x-axis#5326
archmoj merged 4 commits into
masterfrom
date-head-label-on-sides

Conversation

@archmoj

@archmoj archmoj commented Dec 7, 2020

Copy link
Copy Markdown
Contributor

Fixes #5324.

@plotly/plotly_js

@archmoj archmoj added bug something broken status: reviewable labels Dec 7, 2020
@alexcjohnson

Copy link
Copy Markdown
Collaborator

This flips the date upside down - so whatever is normally the second line is the first line in these cases where the labels are bottom-aligned. I don't think that's what we want - we want the order to remain as it was, just move the single-line labels up one line worth.

Perhaps we can do that by, instead of deleting the second line, replacing it (just in these bottom-aligned cases) with a blank line? The logic for whether or not to include the second line is here:

} else if(!ax._inCalcTicks || (headStr !== ax._prevDateHead)) {
dateStr += '<br>' + headStr;
ax._prevDateHead = headStr;
}

@archmoj

archmoj commented Dec 8, 2020

Copy link
Copy Markdown
Contributor Author

This flips the date upside down - so whatever is normally the second line is the first line in these cases where the labels are bottom-aligned. I don't think that's what we want - we want the order to remain as it was, just move the single-line labels up one line worth.

Perhaps we can do that by, instead of deleting the second line, replacing it (just in these bottom-aligned cases) with a blank line? The logic for whether or not to include the second line is here:

} else if(!ax._inCalcTicks || (headStr !== ax._prevDateHead)) {
dateStr += '<br>' + headStr;
ax._prevDateHead = headStr;
}

Good call. Addressed in 11dcbf5.

@alexcjohnson alexcjohnson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! 💃

@archmoj
archmoj merged commit 0dd5467 into master Dec 8, 2020
@archmoj
archmoj deleted the date-head-label-on-sides branch December 8, 2020 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug something broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x-axis second line date formatting edge case

2 participants